﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StudentSetAssistance.aspx.cs" Inherits="ZX.WebApp.Crm.StudentSetAssistance" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="../Scripts/yui_2.9.0/build/connection/connection-min.js"></script>
    <script src="../Scripts/jquery-1.6.min.js" type="text/javascript"></script>
    <script src="../Scripts/jquery.json-2.2.min.js" type="text/javascript"></script>
    <script src="../Scripts/Jquery.form.js" type="text/javascript"></script>
    <script src="../Scripts/extend.validate.js" type="text/javascript"></script>
    <script src="../Scripts/CombinButton.js" type="text/javascript"></script>
    <script src="../Scripts/jquery.calendar.js" type="text/javascript"></script>
    <script src="../Scripts/Public.js" type="text/javascript"></script>
    <link href="../Styles/default/calendar.css" rel="stylesheet" type="text/css" />
    <link href="../Styles/base.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table id="fieldTable">
            <tr>
                <td style="width:80px;">
                    团号：<span style="color: Red">*</span>
                </td>
                <td>
                    <select id="GroupName" name="GroupName" style="width:50%;"></select>
                </td>
            </tr>
            <tr>
                <td>
                    辅导员：
                </td>
                <td>
                    <input type="hidden" id="Assistance" runat="server" />
                    <input runat="server" type="text" id="txtAssistance" name="txtAssistance" readonly="readonly"
                        style="width: 150px;" />
                    <button id="btnAssistance" name="Z" type="button" class="btnCheck" style="width: 50px;">
                        选择</button>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
<script type="text/javascript">
    var Id="";
    $(document).ready(function () {
        Id= getPar1("id");
        LoadGroupNameData();
    });
    var LoadGroupNameData = function () {
        if (Id != "") {
            YAHOO.util.Connect.asyncRequest('GET', "../../Extend/AjaxData/CustomOperating.aspx?r=" + Math.random() + "&id=" + Id + "&action=check&entity=MajorStudentGroupName",
            { success: function (res) {
                try {
                    var str = res.responseText;
                    var arr = [];
                    var obj = eval(str);
                    document.getElementById("GroupName").options.length = 0;
                    $("#GroupName").append("<option value=''> </option>");
                    for (var i = 0; i < obj.length; i++) {
                        $("#GroupName").append("<option value='" + obj[i].GroupName + "'>" + obj[i].GroupName + "</option>");
                    }
                }
                catch (e) {
                }
                finally {
                }
            }, failure: function () { }
            });
        }
    }
    //保存设置辅导员
    function Save() {
        var GroupName = $("#GroupName").val();
        var Assistance = $("#Assistance").val();
        if (Assistance == "") {
            Assistance = "00000000-0000-0000-0000-000000000000";
        }
        if (GroupName == "") {
            parent._state = "";
            alert("团号必须选择!");
            return;
        }
        parent._state = "0";
        if (confirm("确定是否保存?")) {
            SaveData(GroupName, Assistance);
        }
    }
    var SaveData = function (GroupName, Assistance) {
        YAHOO.util.Connect.asyncRequest('GET', "../../Extend/AjaxData/CustomOperating.aspx?r=" + Math.random() + "&id=" + Id + "&name=" + GroupName + "&assistance=" + Assistance + "&action=update&entity=MajorStudentGroupName",
            { success: function (res) {
                try {
                    var str = res.responseText;
                    if (str == "1") {
                        alert("设置成功!");
                        parent.ReLoadData();
                    } else {
                        alert(str);
                    }
                }
                catch (e) {
                }
                finally {
                }
            }, failure: function () { }
            });
    }
</script>
</html>
